/*     */ package change.org.eclipse.swt.browser;
/*     */ 
/*     */ import java.io.PrintStream;

import org.eclipse.swt.browser.TitleEvent;
/*     */ import org.eclipse.swt.graphics.Point;
/*     */ import org.mozilla.interfaces.nsIBaseWindow;
/*     */ import org.mozilla.interfaces.nsIEmbeddingSiteWindow;
/*     */ import org.mozilla.interfaces.nsISupports;
import org.mozilla.interfaces.nsIWebBrowser;
/*     */ 
/*     */ public class EmbeddingSiteWindow
/*     */   implements nsIEmbeddingSiteWindow
/*     */ {
/*     */   AbstractMozillaBrowser browser;
/*     */ 
/*     */   public EmbeddingSiteWindow(AbstractMozillaBrowser aBrowser)
/*     */   {
/*  23 */     this.browser = aBrowser;
/*     */   }
/*     */ 
/*     */   public nsISupports queryInterface(String riid) {
/*  27 */     if (riid.equals("{3e5432cd-9568-4bd1-8cbe-d50aba110743}")) {
/*  28 */       return this;
/*     */     }
/*  30 */     return this.browser.queryInterface(riid);
/*     */   }
/*     */ 
/*     */   public void setDimensions(long flags, int x, int y, int cx, int cy) {
/*  34 */     if (flags == 1L)
/*  35 */       this.browser.location = new Point(x, y);
/*     */   }
/*     */ 
/*     */   public void getDimensions(long flags, int[] x, int[] y, int[] cx, int[] cy) {
/*     */   }
/*     */ 
/*     */   public void setFocus() {
/*  42 */     nsIBaseWindow baseWindow = (nsIBaseWindow)this.browser.webBrowser.queryInterface("{046bc8a0-8015-11d3-af70-00a024ffc08c}");
/*  43 */     baseWindow.setFocus();
/*     */   }
/*     */ 
/*     */   public boolean getVisibility() {
/*  47 */     return true;
/*     */   }
/*     */ 
/*     */   public void setVisibility(boolean aVisibility)
/*     */   {
/*     */     int i;
/*  51 */     MozillaWindowEvent event = new MozillaWindowEvent(this.browser);
/*  52 */     event.display = this.browser.getDisplay();
/*  53 */     event.widget = this.browser;
/*  54 */     if (aVisibility)
/*     */     {
/*  60 */       if (!(this.browser.visible)) {
/*  61 */         this.browser.visible = true;
/*  62 */         event.location = this.browser.location;
/*  63 */         event.size = this.browser.size;
/*  64 */         event.addressBar = this.browser.addressBar;
/*  65 */         event.menuBar = this.browser.menuBar;
/*  66 */         event.statusBar = this.browser.statusBar;
/*  67 */         event.toolBar = this.browser.toolBar;
/*  68 */         for (i = 0; i < this.browser.visibilityWindowListeners.length; ++i)
/*  69 */           this.browser.visibilityWindowListeners[i].show(event);
/*  70 */         this.browser.location = null;
/*  71 */         this.browser.size = null;
/*     */       }
/*     */     } else {
/*  74 */       this.browser.visible = false;
/*  75 */       for (i = 0; i < this.browser.visibilityWindowListeners.length; ++i)
/*  76 */         this.browser.visibilityWindowListeners[i].hide(event);
/*     */     }
/*     */   }
/*     */ 
/*     */   public String getTitle() {
/*  81 */     return "";
/*     */   }
/*     */ 
/*     */   public void setTitle(String aTitle) {
/*  85 */     if (this.browser.titleListeners.length == 0)
/*  86 */       return;
/*  87 */     TitleEvent event = null;
/*     */     try
/*     */     {
/*  90 */       event = new TitleEvent(this.browser);
/*  91 */       event.display = this.browser.getDisplay();
/*  92 */       event.widget = this.browser;
/*  93 */       event.title = aTitle;
/*     */     } catch (Throwable e) {
/*  95 */       System.out.println(e.getMessage());
/*  96 */       event = null;
/*     */     }
/*  98 */     for (int i = 0; i < this.browser.titleListeners.length; ++i)
/*  99 */       this.browser.titleListeners[i].changed(event);
/*     */   }
/*     */ 
/*     */   public long getSiteWindow()
/*     */   {
/* 110 */     return this.browser.getHandle();
/*     */   }
/*     */ }
